package com.collectplus.express.model;

import java.io.Serializable;
import java.math.BigDecimal;

import droid.frame.utils.sqlite.annotation.Column;

/**
 * 位置
 * 
 * @author coffee<br>
 *         2015-8-3下午4:51:22
 */
public class LocationBean implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4504336288800117454L;

	private int id;

	private String name1;// 小区名称
	private String name2;// 楼号、门牌号
	@Column(name = "name")
	private String address;// 小区+楼号门牌号的完整地址
	private String longitude;// 经度
	private String latitude;// 维度
	private BigDecimal x; //
	private BigDecimal y; // 平面坐标

	private int provinceId;// 省
	private int cityId;// 市
	private int districtId;// 区
	private int areaId;// 片区

	// local
	private boolean isSelect = false;

	public LocationBean() {

	}

	public LocationBean(String name1, String name2, String longitude, String latitude, BigDecimal x, BigDecimal y) {
		this.name1 = name1;
		this.name2 = name2;
		this.address = name1 + name2;
		this.longitude = longitude;
		this.latitude = latitude;

		this.x = x;
		this.y = y;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((address == null) ? 0 : address.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		LocationBean other = (LocationBean) obj;
		if (address == null) {
			if (other.address != null)
				return false;
		} else if (!address.equals(other.address))
			return false;
		return true;
	}

	public String getName1() {
		return name1;
	}

	public void setName1(String name1) {
		this.name1 = name1;
	}

	public String getName2() {
		return name2;
	}

	public void setName2(String name2) {
		this.name2 = name2;
	}

	//
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getLongitude() {
		return longitude;
	}

	public void setLongitude(String longitude) {
		this.longitude = longitude;
	}

	public String getLatitude() {
		return latitude;
	}

	public void setLatitude(String latitude) {
		this.latitude = latitude;
	}

	public BigDecimal getX() {
		return x;
	}

	public void setX(BigDecimal xx) {
		this.x = xx;
		x = x.setScale(6, BigDecimal.ROUND_HALF_UP);
	}

	public BigDecimal getY() {
		return y;
	}

	public void setY(BigDecimal yy) {
		this.y = yy;
		y = y.setScale(6, BigDecimal.ROUND_HALF_UP);
	}

	public boolean isSelect() {
		return isSelect;
	}

	public void setSelect(boolean isSelect) {
		this.isSelect = isSelect;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public int getProvinceId() {
		return provinceId;
	}

	public void setProvinceId(int provinceId) {
		this.provinceId = provinceId;
	}

	public int getCityId() {
		return cityId;
	}

	public void setCityId(int cityId) {
		this.cityId = cityId;
	}

	public int getDistrictId() {
		return districtId;
	}

	public void setDistrictId(int districtId) {
		this.districtId = districtId;
	}

	public int getAreaId() {
		return areaId;
	}

	public void setAreaId(int areaId) {
		this.areaId = areaId;
	}
}
